// 封装日期格式化函数
// var time =new Date()
const formatDate = () => {
  var time = new Date()
  var year = time.getFullYear();
  var month = time.getMonth() + 1;
  var day = time.getDate();
  var hour = time.getHours();
  var minute = time.getMinutes();
  var second = time.getSeconds();
  return `${year}-${month}-${day} ${hour}:${minute}:${second}`
}
console.log(formatDate());